import { http } from '@/utils/http';
import type { Home } from './index.d';

export { Home };

/** 获取首页banner */
export const getHomeBannerList = () => {
	return http<Home.BannerData[]>({
		url: `/api/banner/banner_list`,
		method: 'POST',
	});
};

/** 获取首页部分图书列表 */
export const getHomeBookList = () => {
	return http<Home.BookData[]>({
		url: `/api/book/part_book_list`,
		method: 'POST',
	});
};

/** 获取首页计划 */
export const getHomePlanList = () => {
	return http<Home.PlanData[]>({
		url: `/api/plan/home`,
		method: 'GET',
	});
};

/** 获取用户上次学到的书籍 */
export const getHomeLearn = (data: Home.LearnBookParam) => {
	return http<Home.LearnBookData[]>({
		url: `/api/book/recent_learn_boook`,
		method: 'POST',
		data,
	});
};
